import React, { FC } from 'react'
import useStyles from '../../style.style';
import { Avatar } from 'antd';
import moment from 'moment'

interface CommitInputprops {
  giveDataToCommitItem: any;
}

const CommitItem: FC<CommitInputprops> = ({ giveDataToCommitItem }) => {
  const { styles } = useStyles();

  return (
    <div>
      <div className={styles.CommitItemStyle_list}>
        {
          giveDataToCommitItem.map((item: any) => {
            return (
              <div key={item?.time} className={styles.commitItem}>
                <div className={styles.commitItem_title}>
                  <Avatar>{item?.commenter}</Avatar>
                  <span className={styles.commitItem_title_name}>{item?.commenter}</span>
                  <span>{moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')}</span>
                </div>
                <div>{item?.comment}</div>
              </div>
            )
          })
        }
      </div>
    </div>
  )

}

export default CommitItem